package com.chinatelecom.telecollege.sellerrewarding.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.chinatelecom.telecollege.sellerrewarding.service.servicehallService;
import com.chinatelecom.telecollege.sellerrewarding.Entity.servicehall;
import java.util.List;
/**
 * Created by lenovo on 2017/6/21.
 */
@RestController
public class servicehallController {
    @Autowired
    private servicehallService servicehallService;

    @RequestMapping(value = "/servicehall")
    public servicehall queryservicehall(@RequestParam int id) {
        return servicehallService.find(id);
    }

    @RequestMapping(value = "/servicehallall")
    public List<servicehall> queryservicehall() {
        return servicehallService.findAll();
    }

    @RequestMapping(value = "/servicehalladd")
    public String addservicehall(@RequestParam String name) {
        servicehallService.save(name);
        return "Success";
    }

    @RequestMapping(value = "/servicehallmod")
    public String modservicehall(@RequestParam int id,
                                 @RequestParam String name) {
        servicehallService.save(id, name);
        return "Success";
    }

    @RequestMapping(value = "/servicehalldel")
    public String delservicehall(@RequestParam int id) {
        servicehallService.delete(id);
        return "Success";
    }
}
